//
//  NewCell.swift
//  appstore
//
//  Created by llbt-sk on 2019/11/7.
//  Copyright © 2019 Roy. All rights reserved.
//

import UIKit

class NewCell: UITableViewCell {
    
    var titleLabel:UILabel!
    var historyLabel:UILabel!
    var versionLabel:UILabel!
    var dateLabel:UILabel!
    var contentLabel:UILabel!
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
//        self.selectionStyle = .none
        self.initView()
    }
    
    func initView() -> Void {
        // titleLabel
        titleLabel = UILabel()
        titleLabel.text = "What's News"
        titleLabel.font = UIFont.systemFont(ofSize: 22.0)
        self.contentView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { (make) in
            make.left.equalTo(20.0)
            make.top.equalTo(14.0)
            make.width.equalTo(140.0)
            make.height.equalTo(22.0)
        }
    
        // historyLabel
        historyLabel = UILabel()
        historyLabel.text = "Version History"
        historyLabel.font = UIFont.systemFont(ofSize: 17.0)
        historyLabel.textColor = .blue
        self.contentView.addSubview(historyLabel)
        historyLabel.snp.makeConstraints { (make) in
            make.right.equalTo(-20.0)
            make.centerY.equalTo(titleLabel)
            make.width.equalTo(120.0)
            make.height.equalTo(20.0)
        }
        
        // versionLabel
        versionLabel = UILabel()
        versionLabel.text = "Version 1.0.5"
        versionLabel.textColor = .gray
        versionLabel.font = UIFont.systemFont(ofSize: 15.0)
        self.contentView.addSubview(versionLabel)
        versionLabel.snp.makeConstraints { (make) in
            make.left.equalTo(20.0)
            make.top.equalTo(titleLabel.snp.bottom).offset(15.0)
            make.width.equalTo(100.0)
            make.height.equalTo(15.0)
        }
        
        // dateLabel
        dateLabel = UILabel()
        dateLabel.text = "two days ago"
        dateLabel.textColor = .gray
        dateLabel.font = UIFont.systemFont(ofSize: 15.0)
        self.contentView.addSubview(dateLabel)
        dateLabel.snp.makeConstraints { (make) in
            make.right.equalTo(-20.0)
            make.top.equalTo(historyLabel.snp.bottom).offset(15.0)
            make.width.equalTo(100.0)
            make.height.equalTo(18.0)
        }
        
        // contentLabel
        contentLabel = UILabel()
        contentLabel.text = "Here are more styles for playing. You can chose more than 2 characters for yourself. Just have a try!"
        contentLabel.font = UIFont.systemFont(ofSize: 15.0)
        contentLabel.numberOfLines = 0
        self.contentView.addSubview(contentLabel)
        contentLabel.snp.makeConstraints { (make) in
            make.left.equalTo(20.0)
            make.top.equalTo(versionLabel.snp.bottom).offset(20.0)
            make.right.equalTo(-20.0)
            make.bottom.equalTo(-20.0)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
